<div id="addCommentHistory">

	<g:flashMessage/>
	<g:hasErrors bean="${commentHistoryInstance}">
		<ul class="errors" role="alert">
			<g:eachError bean="${commentHistoryInstance}" var="error">
				<li
					<g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
						error="${error}" /></li>
			</g:eachError>
		</ul>
	</g:hasErrors>

	<g:form controller="commentHistory" action="addCommentHistoryEvent" class="rows">
		<fieldset>
			<g:hiddenField name="issue.id" value="${issueId }"/>
			<g:hiddenField name="developmentTask.id" value="${developmentTaskId }"/>
			<g:hiddenField name="developmentChecklist.id" value="${developmentChecklistId }"/>
			<g:hiddenField name="project.id" value="${projectId }"/>
			<div
				class="fieldcontain ${hasErrors(bean: commentHistoryInstance, field: 'comment', 'error')} required">
				<label for="comment"><g:message code="commentHistory.comments.label" default="Comment" /> <span class="required-indicator">*</span></label>
				<g:textArea name="comment" cols="60" rows="5" maxlength="2000"
					value="${commentHistoryInstance?.comment}" />
			</div>
		</fieldset>
		<fieldset class="form-actions">
			<g:submitToRemote class="save" controller="commentHistory" value="Add" action="addCommentHistory" update="addCommentHistory" />
		</fieldset>
		
		<g:if test="${issueId}">
			<g:set var="commentHistoryList" value="${edu.uow.devdocs.CommentHistory.findAllByIssue(edu.uow.devdocs.Issue.get(issueId)) }"></g:set>
		</g:if>
		<g:if test="${developmentTaskId}">
			<g:set var="commentHistoryList" value="${edu.uow.devdocs.CommentHistory.findAllByDevelopmentTask(edu.uow.devdocs.DevelopmentTask.get(developmentTaskId)) }"></g:set>
		</g:if>
		<g:if test="${developmentChecklistId}">
			<g:set var="commentHistoryList" value="${edu.uow.devdocs.CommentHistory.findAllByDevelopmentChecklist(edu.uow.devdocs.DevelopmentChecklist.get(developmentChecklistId)) }"></g:set>
		</g:if>
		<g:if test="${projectId}">
			<g:set var="commentHistoryList" value="${edu.uow.devdocs.CommentHistory.findAllByProject(edu.uow.devdocs.Project.get(projectId)) }"></g:set>
		</g:if>
				<table class="sortable">
					<thead>
						<tr>
							<th><g:message code="commentHistory.person.label" default="Person" /></th>
							<th><g:message code="commentHistory.dateOfComment.label" default="Date" /></th>
							<th><g:message code="commentHistory.comment.label" default="Comment" /></th>
						</tr>
					</thead>
					<g:each in="${commentHistoryList}" status="i" var="commentHistoryItemInList">
						<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
							<td><g:link controller="commentHistory" action="show" id="${commentHistoryItemInList.id}">${fieldValue(bean: commentHistoryItemInList, field: "person")}</g:link></td>
							<td><g:formatDate format="dd/MM/yyyy" date="${commentHistoryItemInList.dateOfComment}"/></td>
							<td>${fieldValue(bean: commentHistoryItemInList, field: "comment")}</td>
						</tr>
					</g:each>
					</table>
	</g:form>
</div>